package com.example.leetcode.leetcode;

/**
 * @author haitao
 */
public class Solution1437 {

    public static int kthFactor(int n, int k) {
        int tag = 0;
        for (int i = 1; i <=n; i++) {
            if (n%i==0){
                tag++;
            }
            if (tag == k){
                return i;
            }
        }
        return -1;
    }
    public static void main(String[] args) {
        System.out.println(kthFactor(12,3));
    }
}
